$(function(){
    $("#upload-btn").on("click",function(){
        var username=$("#username").val();
        var password=$("#password").val();
        var rklx = $("#rklx").val();
        if(username==""||password==""){
            $.alert("请填写用户名或密码！");
        }else{
            var o = new AjaxOptions('#data_form');
            o.put('service_code', 'P90001');
            o.sus = function(data){
                var result = data.result;
                if(result=="0"){
                    $.alert("绑定失败，请检查用户名或密码是否输入正确!");
                }else if(result=="1"){
                    $.toast("绑定成功");
                    window.setTimeout(function(){
                        location.href='https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx1f8a25fd9283cc6e&redirect_uri=http%3a%2f%2falyun.jtgzfw.com%3a8780%2fwcjz%2fwx%2fsnsapi.do%3fservice%3dS40001%26rklx%3d'+rklx+'&response_type=code&scope=snsapi_base&state=lianzt#wechat_redirect';
                    },2000);
                }else if(result=="2"){
                    $.alert("绑定失败，密码输入不正确!");
                }else if(result=="3"){
                    $.alert("该用户已被绑定!");
                }
            };
            $.ajax(o);
        }
    });
});